package com.weipt.juc;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @author peter.wei 2020/09/15 20:39
 * @version 1.0
 * @company CBI
 * @description <br>peter.wei 2020/09/15 20:39
 **/
public class TestCallable {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable myCallable = new MyCallable();
        FutureTask futureTask = new FutureTask(myCallable);
        new Thread(futureTask).start();
        Object o = futureTask.get();
        System.out.println(o);
    }
}


class MyCallable implements Callable{
    @Override
    public Object call() throws Exception {
        System.out.println("call");
        return 1024;
    }
}
